package com.zbkj.service.service.user.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.common.model.user.UserInvoice;
import com.zbkj.service.dao.user.UserInvoiceMapper;
import com.zbkj.service.service.user.UserInvoiceService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户发票表 服务实现类
 * </p>
 *
 * @author 
 * @since 2024-09-15
 */
@Service
public class UserInvoiceServiceImpl extends ServiceImpl<UserInvoiceMapper, UserInvoice> implements UserInvoiceService {

    @Override
    public UserInvoice getInvoiceByUserId(Long userId) {
        LambdaQueryWrapper<UserInvoice> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(UserInvoice::getDeleteFlag, 0)
                .eq(UserInvoice::getUserId, userId)
                .last(" limit 1");
        return this.getOne(queryWrapper,false);
    }
}
